package threadjuc.functionalinterface;

import java.util.Stack;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @author zxl
 * @version 1.0
 * @date 2021/10/28 11:37
 * 函数式接口
 */
public class demo1 {
    public static void main(String[] args) {
        test1();
    }

    private static void test1() {
        //输入什么返回什么
        Function function = str->str;
        System.out.println(function.apply("aa"));

        //输入什么 返回boolean
        Predicate<String> predicate = str->str.isEmpty();
        System.out.println(predicate.test("哈哈"));

        //消费型接口
        Consumer<String> consumer = s -> System.out.println(s);
        consumer.accept("呵呵");

        //供给型接口
        Supplier<String> supplier = ()->"嘿嘿";
        System.out.println(supplier.get());
    }
}
